package context

import (
	"go-test/src/com/miao/common/set"
	"go-test/src/com/miao/common/utils"
	"sync"
)

type Ids struct {
	sync.RWMutex
	Idsmap map[string]*ChannelContext
}

func NewIds() *Ids {
	return &Ids{Idsmap:make(map[string]*ChannelContext)}
}

func (ids *Ids) bind(chanel *ChannelContext, id string) {
	return
}

func (ids *Ids) findId(id string)  *ChannelContext{
	if utils.StrIsEmpty(id) {
		return nil
	}
	return ids.Idsmap[id]
}

func ( ids *Ids )  findSet(key string) *set.Set{
	return nil
}

func (ids *Ids) unbind(chanel *ChannelContext, id string){
	return
}

func (ids *Ids) unbindAll(chanel *ChannelContext){
	id :=chanel.Id
	if utils.StrIsEmpty(id) {
		return
	}
	delete(ids.Idsmap,id)
	chanel.Id=""
}
